import 'dart:convert' show json;

import 'package:freedom/entity/abstract_formart.dart';

import 'package:freedom/util/data_type.dart';

class VerificationMode implements AbstractFormart {
  VerificationMode({
    this.backGroundImage,
    this.moveImage,
    this.scale,
    this.id,
    this.x,
    this.y,
  });

  factory VerificationMode.fromJson(Map<String, dynamic>? jsonRes) {
    if (jsonRes == null) {
      return VerificationMode();
    }
    return VerificationMode(
      backGroundImage: asT<String>(jsonRes['backGroundImage']),
      moveImage: asT<String>(jsonRes['moveImage']),
      scale: asT<double>(jsonRes['scale']),
      id: asT<String>(jsonRes['id']),
      x: asT<double>(jsonRes['x']),
      y: asT<double>(jsonRes['y']),
    );
  }

  String? backGroundImage;
  String? moveImage;
  double? scale;
  String? id;
  double? x;
  double? y;

  Map<String, dynamic> toJson() => <String, dynamic>{
        'backGroundImage': backGroundImage,
        'moveImage': moveImage,
        'scale': scale,
        'id': id,
        'x': x,
        'y': y,
      };

  @override
  String toString() {
    return json.encode(this);
  }

  @override
  caseToEntity(Map<String, dynamic> jsonRes) {
    return VerificationMode.fromJson(jsonRes);
  }
}
